#include "defines.h"

inline void set_DATA(unsigned char data)  {P1OUT =   data;}
inline void set_LATCH(void)       {PJOUT |=  LATCH;}
inline void clr_LATCH(void)       {PJOUT &= ~LATCH;}
inline void set_PHASE_SHORT(void) {PJOUT |=  PHASE_SHORT;}
inline void clr_PHASE_SHORT(void) {PJOUT &= ~PHASE_SHORT;}
inline void set_PHASE_LONG(void)  {PJOUT |=  PHASE_LONG;}
inline void clr_PHASE_LONG(void)  {PJOUT &= ~PHASE_LONG;}
inline void set_nEN_VDD(void)     {P5OUT |=  nEN_VDD;}
inline void clr_nEN_VDD(void)     {P5OUT &= ~nEN_VDD;}
inline void set_PL_EN(void)       {P5OUT |=  PL_EN;}
inline void clr_PL_EN(void)       {P5OUT &= ~PL_EN;}
inline void set_RCLK(void)        {P5OUT |=  RCLK;}
inline void clr_RCLK(void)        {P5OUT &= ~RCLK;}
inline void set_PHASE(void)       {PJOUT |=  (PHASE_SHORT + PHASE_LONG);}
inline void clr_PHASE(void)       {PJOUT &= ~(PHASE_SHORT + PHASE_LONG);}

//inline void set_LED(void)         {    LDOKEYPID = 0x9628;                     // Enable access to config registers 
//                                       PUCTL |= (PUOUT0);             // XOR PU.0/1    
//                                       LDOKEYPID = 0x0;                        // Disbale access to config registers 
//                                  }
//inline void clr_LED(void)         {    LDOKEYPID = 0x9628;                     // Enable access to config registers 
//                                       PUCTL &= ~PUOUT0;             // XOR PU.0/1    
//                                       LDOKEYPID = 0x0;                        // Disbale access to config registers 
//                                  }
//inline void tog_LED(void)         {    LDOKEYPID = 0x9628;                     // Enable access to config registers 
//                                       PUCTL ^= (PUOUT0);             // XOR PU.0/1    
//                                       LDOKEYPID = 0x0;                        // Disbale access to config registers 
//                                  }

inline void set_nEN_3V(void)      {P6OUT |=  nEN_3V;}
inline void clr_nEN_3V(void)      {P6OUT &= ~nEN_3V;}
inline void set_CCLK(void)        {P6OUT |=  CCLK;}
inline void clr_CCLK(void)        {P6OUT &= ~CCLK;}
//inline void set_EN_TEMP(void)     {PJOUT |=  EN_TEMP;}
//inline void clr_EN_TEMP(void)     {PJOUT &= ~EN_TEMP;}
inline void set_EN_HV(void)       {P6OUT |=  EN_HV;}
inline void clr_EN_HV(void)       {P6OUT &= ~EN_HV;}
inline void set_ENABLE(void)      {P6OUT |=  ENABLE;}
inline void clr_ENABLE(void)      {P6OUT &= ~ENABLE;}

inline void tgl_PHASE(void)             {PJOUT ^=  (PHASE_SHORT + PHASE_LONG);}
inline void tgl_LATCH_RCLK_PHASE(void)  {PJOUT ^=  (LATCH + PHASE_SHORT + PHASE_LONG); P5OUT ^= RCLK;}
inline void clr_LATCH_RCLK(void)        {PJOUT &= ~LATCH; P5OUT &=~ RCLK;}
